home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / HENSA / MATHS / PLPLOT / PLPLOT.ZIP / include / arcdraw.h next >
C/C++ Source or Header  |  1996-02-01  |  6KB  |  249 lines

  1. /* $Id: arcdraw.h,v 1.0 1996/1/5 08:31:37 $
  2.  * $Log: arcdraw.h,v $
  3.  *
  4.  * Acorn RISC OS draw file format objects*
  5.  *
  6. */
  7.  
  8. #ifndef arcdraw_h
  9. #define arcdraw_h
  10.  
  11. #
  12. /* --- Rectangular box: bounding boxes, etc. --- */
  13.  
  14. typedef struct {int x0, y0, x1, y1;} pldraw_box;
  15.  
  16. typedef int pldraw_sizetyp;
  17. typedef int pldraw_coltyp;
  18. typedef int pldraw_pathwidth;   /* 1 word */
  19. typedef pldraw_box pldraw_bboxtyp;
  20.  
  21.  
  22. /* Types of join */
  23.  
  24. typedef enum
  25. { join_mitred   = 0,
  26.   join_round    = 1,
  27.   join_bevelled = 2
  28. } pldraw_jointyp;
  29.  
  30.  
  31. /* Types of cap specification */
  32.  
  33. typedef enum
  34. { cap_butt     = 0,
  35.   cap_round    = 1,
  36.   cap_square   = 2,
  37.   cap_triangle = 3
  38. } pldraw_captyp;
  39.  
  40.  
  41. /* Types of winding rule */
  42.  
  43. typedef enum
  44. { wind_nonzero = 0,
  45.   wind_evenodd = 1
  46. } pldraw_windtyp;
  47.  
  48.  
  49. /* Dash types */
  50.  
  51. typedef enum
  52. { dash_absent  = 0,
  53.   dash_present = 1
  54. } pldraw_dashtyp;
  55.  
  56.  
  57. /* Values used for pack/unpack of draw data */
  58.  
  59. #define packmask_join     0x03
  60. #define packmask_endcap   0x0C
  61. #define packmask_startcap 0x30
  62. #define packmask_windrule 0x40
  63. #define packmask_dashed   0x80
  64. #define packshft_join        0
  65. #define packshft_endcap      2
  66. #define packshft_startcap    4
  67. #define packshft_windrule    6
  68. #define packshft_dashed      7
  69.  
  70.  
  71. /* A Path style */
  72.  
  73. typedef struct
  74. { unsigned char joincapwind;       /* 1 byte  */ /* bit 0..1 join         */
  75.                                                  /* bit 2..3 end cap      */
  76.                                                  /* bit 4..5 start cap    */
  77.                                                  /* bit 6    winding rule */
  78.                                                  /* bit 7    dashed       */
  79.   unsigned char reserved8;         /* 1 byte  */
  80.   unsigned char tricapwid;         /* 1 byte  */ /* 1/16th of line width */
  81.   unsigned char tricaphei;         /* 1 byte  */ /* 1/16th of line width */
  82. } pldraw_pathstyle;
  83.  
  84.  
  85. typedef char pldraw_fontref;    /* 1 byte */
  86.  
  87.  
  88.  
  89. typedef unsigned int pldraw_fontsize;  /* 4 bytes, unsigned */
  90.  
  91.  
  92.  
  93. typedef enum
  94. { pldraw_OBJFONTLIST = 0,
  95.   pldraw_OBJTEXT     = 1,
  96.   pldraw_OBJPATH     = 2,
  97.   pldraw_OBJSPRITE  = 5,
  98.   pldraw_OBJGROUP   = 6,
  99.   pldraw_OBJTEXTAREA = 9,
  100.   pldraw_OBJTEXTCOL  = 10
  101. } pldraw_tagtyp;
  102.  
  103. typedef struct { int x,y; } pldraw_objcoord;
  104.  
  105. /* -------------------------------------------------------------------------  *
  106.  *
  107.  * File header
  108.  *
  109.  *
  110.  */
  111.  
  112. typedef struct
  113. { char title[4];
  114.   int  majorstamp;
  115.   int  minorstamp;
  116.   char progident[12];
  117.   pldraw_bboxtyp   bbox;      /* 4 words */
  118. } pldraw_fileheader;
  119.  
  120.  
  121. /* -------------------------------------------------------------------------  *
  122.  * General header for graphic objects
  123.  *
  124.  */
  125.  
  126. typedef struct
  127. { pldraw_tagtyp    tag;       /* 1 word  */
  128.   pldraw_sizetyp   size;      /* 1 word  */
  129.   pldraw_bboxtyp   bbox;      /* 4 words */
  130. } pldraw_objhdr;
  131.  
  132.  
  133.  
  134.  
  135. /* -------------------------------------------------------------------------  *
  136.  *
  137.  * Elements within a path                                                     *
  138.  *
  139.  */
  140.  
  141. typedef enum
  142.  { pldraw_PathTERM  = 0,     /* end of path                                   */
  143.    pldraw_PathMOVE  = 2,     /* move to (x,y), starts new subpath             */
  144.    pldraw_PathLINE  = 8,     /* line to (x,y)                                 */
  145.    pldraw_PathCURVE = 6,     /* bezier curve to (x3,y3) with 2 control points */
  146.    pldraw_PathCLOSE = 5      /* close current subpath with a line             */
  147. } pldraw_path_tagtype;
  148.  
  149. typedef struct { pldraw_path_tagtype tag; int x,y; } Path_movestr;
  150.  
  151. typedef struct { pldraw_path_tagtype tag; int x,y; } Path_linestr;
  152.  
  153. typedef struct { pldraw_path_tagtype tag; int x1,y1;
  154.                                         int x2,y2; int x3,y3; } Path_curvestr;
  155.  
  156. typedef struct { pldraw_path_tagtype tag; } Path_closestr;
  157.  
  158. typedef struct { pldraw_path_tagtype tag; } Path_termstr;
  159.  
  160. typedef union           /* Use ONLY for space checking purposes */
  161. { Path_movestr a;Path_linestr b;Path_curvestr c;Path_closestr d;Path_termstr e;
  162. } Largest_path_str;
  163.  
  164.  
  165. typedef union
  166. { Path_movestr  *move;
  167.   Path_linestr  *line;
  168.   Path_curvestr *curve;
  169.   Path_closestr *close;
  170.   Path_termstr  *term;
  171.  
  172.   char *bytep;
  173.   int  *wordp;
  174. } Path_eleptr;
  175.  
  176. /* -------------------------------------------------------------------------  *
  177.  *
  178.  * Optional dashpattern                                                       *
  179.  *
  180.  */
  181.  
  182.  
  183. typedef struct
  184. { int dashstart;       /* 1 word */           /* distance into pattern */
  185.   int dashcount;       /* 1 word */           /* number of elements    */
  186. } pldraw_dashstrhdr;
  187.  
  188. typedef struct
  189. { int dashstart;       /* 1 word */           /* distance into pattern */
  190.   int dashcount;       /* 1 word */           /* number of elements    */
  191.   int dashelements[6]; /* dashcount words */  /* elements of pattern   */
  192. } pldraw_dashstr;
  193.  
  194.  
  195. /* -------------------------------------------------------------------------  *
  196.  *
  197.  * Unpacked joint,start cap,end cap structure - as fed to drawmod_stroke etc  *
  198.  *
  199.  */
  200.  
  201. typedef struct
  202. { char join;
  203.   char endcap;
  204.   char startcap;
  205.   char reserved;  /* must be zero */
  206.   int  mitrelimit;
  207.   short endtricapwid;
  208.   short endtricaphei;
  209.   short starttricapwid;
  210.   short starttricaphei;
  211. } pldraw_jointspec;
  212.  
  213.  
  214. /* -------------------------------------------------------------------------  *
  215.  *
  216.  * A path
  217.  *
  218.  */
  219.  
  220. typedef struct
  221. { pldraw_tagtyp    tag;        /* 1 word  */
  222.   pldraw_sizetyp   size;       /* 1 word  */
  223.   pldraw_bboxtyp   bbox;       /* 4 words */
  224.   pldraw_coltyp    fillcolour; /* 1 word  */
  225.   pldraw_coltyp    pathcolour; /* 1 word  */
  226.   pldraw_pathwidth pathwidth;  /* 1 word  */
  227.   pldraw_pathstyle pathstyle;  /* 1 word  */
  228. } pldraw_pathstrhdr;
  229.  
  230. typedef struct
  231. { pldraw_tagtyp    tag;        /* 1 word  */
  232.   pldraw_sizetyp   size;       /* 1 word  */
  233.   pldraw_bboxtyp   bbox;       /* 4 words */
  234.   pldraw_coltyp    fillcolour; /* 1 word  */
  235.   pldraw_coltyp    pathcolour; /* 1 word  */
  236.   pldraw_pathwidth pathwidth;  /* 1 word  */
  237.   pldraw_pathstyle pathstyle;  /* 1 word  */
  238.  
  239.   pldraw_dashstr data;      /* optional dash pattern, then path elements */
  240.  int PATH;
  241. } pldraw_pathstr;
  242.  
  243.  
  244.  
  245. #endif
  246.  
  247. /* end of drawtypes.h */
  248.  
  249.